package com.fenghongzhang.day006;

import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;

import androidx.appcompat.app.AppCompatActivity;

public class Main2Activity extends AppCompatActivity {
    private Button btn;
    private ImageView img;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main2);


        btn = (Button) findViewById(R.id.btn);
        img = (ImageView) findViewById(R.id.img);

    }

    public void btn(View view) {

        img.setImageResource(R.drawable.kaiwayi);
        AnimationDrawable drawable = (AnimationDrawable) img.getDrawable();
        drawable.start();
//        drawable.stop();

    }
}
